<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片播放</title>
    <style>
        div {
            width: 700px;
            height: 500px;
            text-align: center;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div>
        <img src="./图片/aaa.png" style="width: 700px; height:500px">
    </div>
    <script>
        //HTMLCollection数组
        var img = document.getElementsByTagName('img')[0];
        const imgArr = ['bbb.png', 'ccc.png', 'ddd.png'];
        var count = 0;
        //只执行一次
        function fn() {
            if(count<2){
                count++;
            }else{
                count = 0;
            }
            
            img.src = './图片/' + imgArr[count];
            //n! 递归(调用函数本身): 出口， 表达式
            return setTimeout(fn, 1000);
        }
        setTimeout(fn, 1000);
    </script>
</body>
</html>